﻿using BCCommon.TMS.Order;
using BCEntity.TMS.Order.OrderExtention;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BCData.TMS.Order.OrderExtention
{
    /// <summary>
    /// 订单扩展信息
    /// </summary>
    public interface IOrderExtentionData
    {
        /// <summary>
        /// 添加订单扩展信息
        /// </summary>
        /// <param name="orderExtentionEntities">订单扩展信息列表</param>
        /// <returns></returns>
        Task<bool> Add(List<OrderExtentionEntity> orderExtentionEntities);
        /// <summary>
        /// 获取订单扩展信息
        /// </summary>
        /// <param name="orderNo">订单编号</param>
        /// <returns></returns>
        Task<IEnumerable<OrderExtentionEntity>> GetList(string orderNo);
        /// <summary>
        /// 获取订单扩展信息
        /// </summary>
        /// <param name="orderId">订单Id</param>
        /// <returns></returns>
        Task<IEnumerable<OrderExtentionEntity>> GetList(long orderId);
        /// <summary>
        /// 获取订单未到达的扩展信息
        /// </summary>
        /// <param name="orderNo">订单编号</param>
        /// <returns></returns>
        Task<IEnumerable<OrderExtentionEntity>> GetNotArrived(string orderNo);
        #region 修改订单扩展信息状态
        /// <summary>
        /// 修改订单扩展订单状态--已到达
        /// </summary>
        /// <param name="orderNo">订单编号</param>
        /// <param name="orderExtentionId">订单扩展Id</param>
        /// <returns></returns>
        Task<bool> UpdateOrderStatusArrived(string orderNo, long orderExtentionId);
        /// <summary>
        /// 修改订单扩展订单状态--取货中
        /// </summary>
        /// <param name="orderNo">订单编号</param>
        /// <returns></returns>
        Task<bool> UpdateOrderStatusPickup(string orderNo);
        /// <summary>
        /// 修改订单扩展订单状态--运输中
        /// </summary>
        /// <param name="orderNo">订单编号</param>
        /// <param name="orderExtentionId">订单扩展Id</param>
        /// <returns></returns>
        Task<bool> UpdateOrderStatusTransporting(string orderNo, long orderExtentionId);
        /// <summary>
        /// 修改订单扩展订单状态--运输中
        /// </summary>
        /// <param name="orderNo">订单编号</param>
        /// <returns></returns>
        Task<bool> UpdateOrderStatusTransporting(string orderNo);
        /// <summary>
        /// 修改订单扩展订单状态--已签收
        /// </summary>
        /// <param name="orderNo">订单编号</param>
        /// <param name="orderExtentionId">订单扩展Id</param>
        /// <returns></returns>
        Task<bool> UpdateOrderStatusAcceptance(string orderNo, long orderExtentionId);

        /// <summary>
        /// 修改订单扩展订单状态--已取消
        /// </summary>
        /// <param name="orderNo">订单编号</param>
        /// <returns></returns>
        Task<bool> UpdateOrderStatusCancel(string orderNo);
        /// <summary>
        /// 修改订单扩展订单状态--下单
        /// </summary>
        /// <param name="orderNo">订单编号</param>
        /// <returns></returns>
        Task<bool> UpdateOrderStatusPlaceOrder(string orderNo);
        /// <summary>
        /// 修改订单扩展订单状态--派车中
        /// </summary>
        /// <param name="orderNo">订单编号</param>
        /// <returns></returns>
        Task<bool> UpdateOrderStatusDispatching(string orderNo);
        #endregion

        #region 补充订单扩展信息--装货信息
        /// <summary>
        /// 补充订单扩展信息--装货信息
        /// </summary>
        /// <param name="orderExtentionEntity">订单扩展信息</param>
        /// <returns></returns>
        Task<bool> UpdateLoadingGoods(OrderExtentionEntity orderExtentionEntity);
        #endregion

        #region 修改订单代收货款时间
        /// <summary>
        /// 修改订单代收货款时间
        /// </summary>
        /// <param name="orderNo">订单编号</param>
        /// <param name="orderExtentionId">订单扩展信息Id</param>
        /// <returns></returns>
        Task<bool> UpdateCashedTime(string orderNo, long orderExtentionId);
        #endregion

        #region 补充订单扩展信息--签收签字图片信息
        /// <summary>
        /// 补充订单扩展信息--装货信息
        /// </summary>
        /// <param name="orderExtentionEntity">订单扩展信息</param>
        /// <returns></returns>
        Task<bool> UpdateAcceptanceSignature(OrderExtentionEntity orderExtentionEntity);
        #endregion

        #region 修改订单扩展信息为紧急情况问题单
        /// <summary>
        /// 修改订单扩展信息为紧急情况问题单
        /// </summary>
        /// <param name="orderExtentionId">订单扩展Id</param>
        /// <param name="noneHandled">未处理的</param>
        /// <returns></returns>
        Task<bool> UpdateExtentionProblemOrder(long orderExtentionId, bool noneHandled);
        #endregion

        #region 修改订单扩展信息紧急情况备注
        /// <summary>
        /// 修改订单扩展信息紧急情况备注
        /// </summary>
        /// <param name="orderExtentionId">订单扩展信息Id</param>
        /// <param name="remark">备注</param>
        /// <returns></returns>
        Task<bool> UpdateOrderExtentionProblemRemark(long orderExtentionId, string remark);
        #endregion

        //#region 获取问题单地址信息
        ///// <summary>
        ///// 获取问题单地址信息
        ///// </summary>
        ///// <param name="orderNo">订单编号</param>
        ///// <returns></returns>
        //Task<IEnumerable<ExceptionVehicleEntity>> GetProblemInfo(string orderNo);
        ///// <summary>
        ///// 获取问题单地址信息
        ///// </summary>
        ///// <param name="vehicleId">车辆Id</param>
        ///// <param name="pageIndex">当前页码</param>
        ///// <param name="pageSize">每页数据条数</param>
        ///// <returns></returns>
        //Task<(IEnumerable<ExceptionVehicleEntity>, int)> GetProblemInfo(long vehicleId, int pageIndex, int pageSize);
        //#endregion

        #region 修改异常单已处理
        /// <summary>
        /// 修改异常单已处理
        /// </summary>
        /// <param name="orderExtentionId">订单扩展Id</param>
        /// <returns></returns>
        Task<bool> UpdateExtentionProblemHandled(long orderExtentionId);
        #endregion

        #region 获取所有订单装货地
        /// <summary>
        /// 获取所有订单装货地
        /// </summary>
        /// <param name="addressType">地址类型</param>
        /// <returns></returns>
        Task<IEnumerable<OrderExtentionEntity>> GetOrderAddressTakeListAsync(AddressType addressType);
        #endregion

        /// <summary>
        /// 更新订单扩展信息装货照片信息为空
        /// </summary>
        /// <param name="orderNo">订单编号</param>
        /// <returns></returns>
        Task<bool> UpdateClearLoadPhotosByOrderNoAsync(string orderNo);
        /// <summary>
        /// 获取最后的订单扩展信息
        /// </summary>
        /// <param name="orderNo">订单编号</param>
        /// <returns></returns>
        Task<OrderExtentionEntity> GetLast(string orderNo);

        /// <summary>
        /// 获取最初的订单扩展信息
        /// </summary>
        /// <param name="orderNo">订单编号</param>
        /// <returns></returns>
        Task<OrderExtentionEntity> GetFirst(string orderNo);

        /// <summary>
        /// 修改订单状态
        /// </summary>
        /// <param name="orderNo">订单编号</param>
        /// <returns></returns>
        Task<bool> UpdateOrderStatusArrivedByNo(string orderNo);

        #region 现付付业务--签收订单，修改订单状态及订单扩展信息状态为已完成
        /// <summary>
        /// 现付付业务--签收订单，修改订单状态及订单扩展信息状态为已完成
        /// </summary>
        /// <param name="orderNo">订单编号</param>
        /// <returns></returns>
        Task<bool> UpdateCurrentlyPayOrderStatusComplete(string orderNo);
        #endregion

        #region 到付业务--签收订单，修改订单状态及订单扩展信息状态为已完成
        /// <summary>
        /// 到付业务--签收订单，修改订单状态及订单扩展信息状态为已完成
        /// </summary>
        /// <param name="orderNo">订单编号</param>
        /// <returns></returns>

        Task<bool> UpdateCollectPayOrderStatusComplete(string orderNo);
        #endregion
    }
}
